<%@ page import="br.edu.ufam.controleAcesso.*" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main"/>
        <g:javascript src="app/usuario.js" />
    </head>
    <body>
      <h1>Alterar Usuário</h1><hr/>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${usuario}">
            <div class="errors">
                <g:renderErrors bean="${usuario}" as="list" />
            </div>
            </g:hasErrors>
          <div id="validateErrors"class="errors" style="display:none;">
            <ul></ul>
          </div>
    <br/>
          <g:form name="formUsuarioEdit" controller="usuario" method="post" >
              <input type="hidden" name="id" value="${usuario?.id}" />
           <table  width="100%" border="0" cellspacing="5" cellpadding="0" align="center" class="textoverdana">
            <tr>
              <td>Nome<br/>
                <input type="text" class="texto" size="35" maxlength="250" id="nome" name="nome" value="${fieldValue(bean:usuario,field:'nome')}"/>
              </td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Login (CPF: 88888888888)<br/>
                  <input type="text"                          
                         maxlength="11" 
                         id="login" 
                         name="login" 
                         value="${fieldValue(bean:usuario,field:'login')}"
                         class="text ui-widget-content ui-corner-all"/>
              </td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Senha<br/>
                  <input type="password" 
                         id="senha" 
                         name="senha" 
                         value=""
                         class="text ui-widget-content ui-corner-all"/>
              </td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Confirmação de Senha<br/>
                  <input type="password" 
                         id="confirmaSenha" 
                         name="confirmaSenha" 
                         value=""
                         class="text ui-widget-content ui-corner-all"/>
              </td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td width="300">Grupo:<br/>
                <g:select style="width:225px" 
                          optionKey="id" 
                          from="${Grupo.list()}" 
                          name="grupo.id" 
                          value="${usuario?.grupo?.id}" 
                          noSelection="['':'']" 
                          class="text ui-widget-content ui-corner-all"/>
              </td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td>Aplica&ccedil;&otilde;es dispon&iacute;veis:</td>
                <td>&nbsp;</td>
                <td>Aplica&ccedil;&otilde;es do usu&aacute;rio:</td>
            </tr>
            <tr>
              <td style="width:43%">
                <g:select style="width:100%" 
                          id="lista1" 
                          multiple="multiple" 
                          size="10" 
                          from='${Aplicacao.findAll("from Aplicacao a order by a.menu.descricao, a.descricao") - usuarioAplicacao}' optionKey="id" optionValue="${{it.menu.descricao+' - '+it.descricao}}"></g:select>
              </td>
              <td style="text-align:center">
                <input name="moveRight" 
                       id="moveRight" 
                       type="button" 
                       class="botao" 
                       value="&gt;&gt;" 
                       onClick="move('lista1','lista2');"/> <br/> <br/>
                <input name="moveLeft" 
                       id="moveLeft" 
                       type="button" 
                       class="botao" 
                       value="&lt;&lt;"  
                       onClick="move('lista2','lista1');"/>
              </td>
              <td style="width:43%">
                <g:select style="width:100%" 
                          id="lista2" 
                          name="lista2" 
                          multiple="multiple" 
                          size="10" 
                          from='${usuarioAplicacao}' 
                          optionKey="id" 
                          optionValue="${{it.menu.descricao+' - '+it.descricao}}"></g:select>
              </td>
            </tr>
          </table>
          <p align="center">
              <g:actionSubmit class="botao" id="atualizar" action="update" value="Atualizar" onClick="seleciona('lista2');"/>
              <g:link action="list"><input class="botao" id="voltar" type="button" value="Voltar" /></g:link>
          </p>
          </g:form>
    </body>
</html>
